/*************************** Exercise16 *******************************
 * In the Initialization and Cleanup chapter, locate the Overloading.java
 * example and add Javadoc documentation. Extract this comment documentation
 * into and HTML file using Javadoc and view it with your Web browser.
 ************************************************************************/
package thinkinginjava.everything_is_an_object;

/**
 * The class i used to represent a tree.
 * @author developer
 */
class Tree {

    int height;
    /**
     * Creates an empty tree.
     */
    public Tree() {
        System.out.println("Planting a seedling");
        height = 0;
    }
    /**
     * Creates a tree with specified height.
     * @param initialHeight height of the tree.
     */
    public Tree(int initialHeight) {
        height = initialHeight;
        System.out.println("Creating new Tree that is "
                + height + " feet tall");
    }
    /**
     * Prints information about height of the tree.
     */
    public void info() {
        System.out.println("Tree is " + height + " feet tall");
    }

    /**
     * Overloaded method that prints string passed to the method and
     * height of the tree.
     * @param s - string arguments to make the info method overloaded.
     */
    public void info(String s) {
        System.out.println(s + ": Tree is " + height + " feet tall");
    }
}


/**
 *
 * @author developer
 */
public class Exercise16 {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            Tree t = new Tree(i);
            t.info();
            t.info("overloaded method");
        }
        // Overloaded constructor:
        new Tree();
    }
}
